Conversation
|
네이버 로그인 SDK 연동 작업은 전반적으로 프로젝트의 아키텍처 원칙과 코딩 컨벤션에 맞춰 잘 구현되었습니다. |
| let displayName = (Bundle.main.object(forInfoDictionaryKey: "CFBundleDisplayName") as? String) ?? "" | ||
| let bundleName = (Bundle.main.object(forInfoDictionaryKey: "CFBundleName") as? String) ?? "" | ||
| let appName = displayName.isEmpty ? bundleName : displayName | ||
|
|
||
| let naverClientID = Bundle.main.infoDictionary?["NAVER_CLIENT_ID"] as? String ?? "" | ||
| let naverClientSecret = Bundle.main.infoDictionary?["NAVER_CLIENT_SECRET"] as? String ?? "" | ||
| let naverURLScheme = Bundle.main.infoDictionary?["NAVER_URL_SCHEME"] as? String ?? "" | ||
|
|
||
| if !appName.isEmpty, !naverClientID.isEmpty, !naverClientSecret.isEmpty, !naverURLScheme.isEmpty { | ||
| NidOAuth.shared.initialize( | ||
| appName: appName, | ||
| clientId: naverClientID, | ||
| clientSecret: naverClientSecret, | ||
| urlScheme: naverURLScheme | ||
| ) | ||
| Log.debug("👤 [Naver] Login SDK 초기화 완료") | ||
| } else { | ||
| Log.debug("appName: \(appName)") | ||
| Log.debug("clientId: \(naverClientID)") | ||
| Log.debug("clientSecret: \(naverClientSecret)") | ||
| Log.debug("urlScheme: \(naverURLScheme)") | ||
|
|
||
| Log.debug("⚠️ [Naver] Error: Info.plist에서 네이버 로그인 설정값을 찾을 수 없습니다.") | ||
| } |
There was a problem hiding this comment.
네이버 sdk 초기화 로직을 별도 private method로 분리하면 좀 더 가독성이 개선될 것 같아용!
| let naverClientSecret = Bundle.main.infoDictionary?["NAVER_CLIENT_SECRET"] as? String ?? "" | ||
| let naverURLScheme = Bundle.main.infoDictionary?["NAVER_URL_SCHEME"] as? String ?? "" | ||
|
|
||
| if !appName.isEmpty, !naverClientID.isEmpty, !naverClientSecret.isEmpty, !naverURLScheme.isEmpty { |
There was a problem hiding this comment.
🔵 [P4] Readability
SDK 초기화 조건 검사 시 if 대신 guard let을 사용하여 코드를 더 깔끔하게 구성하고 조기에 반환할 수 있습니다. 이는 가독성 향상에 도움이 됩니다.
| if !appName.isEmpty, !naverClientID.isEmpty, !naverClientSecret.isEmpty, !naverURLScheme.isEmpty { | |
| guard !appName.isEmpty, !naverClientID.isEmpty, !naverClientSecret.isEmpty, !naverURLScheme.isEmpty else { | |
| Log.debug("⚠️ [Naver] Error: Info.plist에서 네이버 로그인 설정값을 찾을 수 없습니다.") | |
| return | |
| } | |
| NidOAuth.shared.initialize( | |
| appName: appName, | |
| clientId: naverClientID, | |
| clientSecret: naverClientSecret, | |
| urlScheme: naverURLScheme | |
| ) | |
| Log.debug("👤 [Naver] Login SDK 초기화 완료") |
| guard !appName.isEmpty, !naverClientID.isEmpty, !naverClientSecret.isEmpty, !naverURLScheme.isEmpty else { | ||
| Log.debug("⚠️ [Naver] Error: Info.plist에서 네이버 로그인 설정값을 찾을 수 없습니다.") | ||
| return | ||
| } |
There was a problem hiding this comment.
⚪ [P5] Nitpick
guard 문의 닫는 중괄호 들여쓰기가 잘못되었습니다. guard 키워드와 같은 레벨로 맞춰주세요.
| } | |
| } |
| Log.debug("⚠️ [Naver] Error: Info.plist에서 네이버 로그인 설정값을 찾을 수 없습니다.") | ||
| return | ||
| } | ||
| NidOAuth.shared.initialize( |
There was a problem hiding this comment.
⚪ [P5] Nitpick
NidOAuth.shared.initialize 호출문의 들여쓰기가 잘못되었습니다. guard 문 다음의 코드 블록으로 guard 키워드와 같은 레벨로 맞춰주세요.
| NidOAuth.shared.initialize( | |
| NidOAuth.shared.initialize( |
| clientId: naverClientID, | ||
| clientSecret: naverClientSecret, | ||
| urlScheme: naverURLScheme | ||
| ) |
There was a problem hiding this comment.
⚪ [P5] Nitpick
initialize 메서드의 닫는 소괄호 들여쓰기가 잘못되었습니다. NidOAuth.shared.initialize(와 같은 레벨로 맞춰주세요.
| ) | |
| ) |
| clientSecret: naverClientSecret, | ||
| urlScheme: naverURLScheme | ||
| ) | ||
| Log.debug("👤 [Naver] Login SDK 초기화 완료") |
There was a problem hiding this comment.
⚪ [P5] Nitpick
Log.debug 호출문의 들여쓰기가 잘못되었습니다. NidOAuth.shared.initialize와 같은 레벨로 맞춰주세요.
| Log.debug("👤 [Naver] Login SDK 초기화 완료") | |
| Log.debug("👤 [Naver] Login SDK 초기화 완료") |
| urlScheme: naverURLScheme | ||
| ) | ||
| Log.debug("👤 [Naver] Login SDK 초기화 완료") | ||
| } |
There was a problem hiding this comment.
⚪ [P5] Nitpick
initializeNaverLoginSDK() 함수의 닫는 중괄호 들여쓰기가 잘못되었습니다. private func 키워드와 같은 레벨로 맞춰주세요.
| } | |
| } |
| ) | ||
| case let .failure(error): | ||
| Log.debug("❌ 네이버 로그인 실패: \(error.localizedDescription)") | ||
| continuation.resume(throwing: SocialAuthClientError.underlying(error.localizedDescription)) |
There was a problem hiding this comment.
🟠 [P2] Major
에러를 전달할 때 error.localizedDescription 대신 원본 error 객체를 직접 래핑하거나, 도메인 계층에서 정의된 특정 에러 타입으로 매핑하는 것이 좋습니다. localizedDescription은 주로 사용자에게 표시하기 위한 목적이며, 디버깅이나 프로그램적인 에러 처리에 필요한 상세 정보가 부족할 수 있습니다. underlying 케이스를 사용한다면 Error 프로토콜을 따르는 원본 error를 직접 넘겨주는 것이 더 나은 관행입니다.
| continuation.resume(throwing: SocialAuthClientError.underlying(error.localizedDescription)) | |
| continuation.resume(throwing: SocialAuthClientError.underlying(error)) |
작업 내용
NidThirdPartyLogin)를 Tuist 의존성에 추가했습니다.NaverLoginService를 추가하고 소셜 로그인 유스케이스에 네이버 로그인 분기를 연결했습니다.변경 사항
Tuist/Package.swift,Package.resolvedExtension+TargetDependencySPM.swift.SPM.nidThirdPartyLogin추가Project+InfoPlist.swift,InfoPlistDictionary.swiftNAVER_CLIENT_ID,NAVER_CLIENT_SECRET,NAVER_URL_SCHEME설정 추가BangawoApp.swiftNaverLoginService.swiftSignInWithSocialUseCaseImpl.swift.naver로그인 분기 추가AuthFactory.swift확인 사항
tuist installtuist generate참고
체크리스트